package com.yhd.filter;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {

    @Bean
    AuthInterceptor authInterceptor(){
        return new AuthInterceptor();
    }


    public void addInterceptors(InterceptorRegistry registry) {
        //拦截所有控制 排除支付宝身份验证
        registry.addInterceptor(authInterceptor()).addPathPatterns("/**")
        .excludePathPatterns("/login**"
                ,"/doLogin"
                ,"/app/**"
                ,"/app/wx/wxPayNotify"
                ,"/user/login"
                ,"/kaptcha"
                ,"/css/**"
                ,"/js/**"
                ,"/images/**"
                ,"/layui*"
                ,"/font/**"
                ,"/swagger-ui.html"
                ,"/treelist/**"
                ,"/xlsx/**"
                ,"/zTree/**"
                ,"/mods/**"
                ,"/download/**"
                ,"/static/download/**"
        );
        super.addInterceptors(registry);
    }

}
